How we added NFTs purchaseable via IAP (in-app purchase) on the iOS App Store and Google Play Store to Jelly Forest and how you can do something similar in your own games
git clone https://github.com/0xsequence-demos/cloudflare-worker-sequence-relayer.git
then cd cloudflare-worker-sequence-relayer
git checkout permissionedMinter
pnpm install
- to install dependancieswrangler.toml
name
stringPKEY
CONTRACT_ADDRESS
PROJECT_ACCESS_KEY
- this is your prod API key from the Builder Console you retrieved earlier when setting up the SequenceConfig
scriptable objectCHAIN_HANDLE
- if you’re not sure what this is, you can see the CHAIN_HANDLE
for each respective network on the Node Gateway page of the Builder Console.pnpm dev
- this will deploy the server locally. You should see which localhost it is deployed to in the command linecurl http://localhost:8787
- substitute whichever localhost you are given. This will ping the server.Contracts
and click to open itWrite Contract
grantRole
role
enter 0x9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6
- this is the Keccak-256 hash of MINTER_ROLE
account
paste the minter’s wallet addresswrangler deploy
- this will deploy the code to a Cloudflare Worker and give you a minting URLproof
is generated by the client sending the minting request. In the Unity SDK this is implemented by the MintingRequestProver.
ProcessPurchase
methods in your IStoreListener
from the integration process, you’ll want to initiate the minting process. In Jelly Forest, this is done via the UnityIAP and PremiumItem scripts.
In terms of the payload, you can see in the PremiumItem
implementation that I am adding a PermissionedMintTransaction to a TransactionQueuer
.
_permissionedMinterTransactionQueuer
is a PermissionedMinterTransactionQueuer
.
This will send a payload in this format: